luci-base: cbi.js: use IEC 80000-13 units to format base 2 byte values
authorJo-Philipp Wich <[email protected]>
Fri, 8 Oct 2021 18:52:52 +0000 (20:52 +0200)
committerJo-Philipp Wich <[email protected]>
Fri, 22 Oct 2021 18:36:47 +0000 (20:36 +0200)
Fixes: #5354
Signed-off-by: Jo-Philipp Wich <[email protected]>
(cherry picked from commit 0a31efc858b02cd5aa9f38c1b5b40a9a14a61c1a)

modules/luci-base/htdocs/luci-static/resources/cbi.js

index 513256e4c9bfea559a54133e8950bc662972c095..b8446ec52ff4844a11147db8977efff645c99ff1 100644 (file)
@@ -646,7 +646,11 @@ String.prototype.format = function()
                                                for (i = 0; (i < units.length) && (val > mf); i++)
                                                        val /= mf;
 
-                                               subst = (i ? val.toFixed(pr) : val) + units[i];
+                                               if (i)
+                                                       subst = val.toFixed(pr) + units[i] + (mf == 1024 ? 'i' : '');
+                                               else
+                                                       subst = val + ' ';
+
                                                pMinLength = null;
                                                break;
                                }